1. Field of the Invention
The present invention relates to a virtual machine, and more particularly, to a method of receiving a digital broadcast in which an ahead-of-time (AOT) compilation operation is performed before, instead of during, execution of a virtual machine application program downloaded from a network.
2. Description of the Related Art
A Java virtual machine provides a standard application execution environment that ensures the mobility of an application program. That is, Java programs are executable by any type of information device. FIG. 1 is a block diagram of a conventional digital broadcast receiver 100 equipped with a virtual machine. Referring to FIG. 1, the digital broadcast receiver 100 includes a central processing unit (CPU) 10, a memory 20, a multimedia system 30, a peripheral device module 40, and a bus 50. The CPU 10, the memory 20, the multimedia system 30, and the peripheral device module 40 are connected to one another via the bus 50.
The multimedia system 30 includes a tuner 31, a demultiplexer 32, a conditional access system 33, a Moving Picture Experts Group (MPEG) decoder 34, and other data processors, such as a graphic processor 35, a video processor 36, and an audio processor 37.
The peripheral device module 40 may include a universal serial bus (USB) connection device 41, a serial connection device 42, an infrared ray (IR) connection device 43, a flash memory 44, an Ethernet communication device 45, and a hard disk 46. Ethernet communication may be configured using a wired packet communication network, such as a local area network (LAN) or an asymmetric digital subscriber line (ADSL)/cable modem-based wide area network (WAN), a wireless LAN, a wireless or mobile communication network based on Code Division Multiplexing Access (CDMA)/Global System for Mobiles (GSM)/General Packet Radio Service (GPRS) technology, or a wired or wireless broadcast network, such as a terrestrial wave broadcast network, a cable broadcast network, or a satellite broadcast network. If the digital broadcast receiver 100 is connected to a LAN, an IEEE 1394 or ADSL network via an Ethernet interface, it can receive a satellite broadcast or a terrestrial wave broadcast. If the digital broadcast receiver 100 receives a cable broadcast via a cable modem, it can support bi-directional communication without the aid of an Ethernet interface because the cable modem supports bi-directional communication. The peripheral device module 40 may also include a Small Computer System Interface (SCSI) or an Enhanced Integrated Device Electronics Interface (EIDEI) hard disk to provide a personal video recording function.
A digital television (DTV) middleware program 22 and a virtual machine 23 reside in memory 20. The DTV middleware program 22 enables the virtual machine 23 to execute a virtual machine application program downloaded from outside the digital broadcast receiver 100 by controlling the multimedia system 30 and the peripheral device module 40. The virtual machine 23 loads the virtual machine application program 21 into memory 30 and then executes the virtual machine application program 21.
The virtual machine application program 21 may be transmitted to the digital broadcast receiver 100 from outside the digital broadcast receiver 100 via a network and may be stored in a non-volatile storage device, such as a hard disk or a flash memory. In the case of being transmitted as a terrestrial wave broadcast or a satellite broadcast, the virtual machine application program 21 may have an MPEG-2 format or a Digital Storage Media-Command and Control (DSM-CC) format.
In the case of being transmitted as a cable broadcast, the virtual machine application program 21 may be delivered through an out-of-band (OOB) channel according to the Open Cable Application Platform (OCAP) specification, in which case, the virtual machine application program 21 is carried by a stream other than an MPEG-2 broadcast stream.
Also, the application can be transmitted over the internet using the Transfer Control Protocol/Internet Protocol (TCP/IP). In the case of receiving a cable broadcast, the digital broadcast receiver 100 may be connected to the Internet via a cable modem. In the case of receiving a terrestrial wave broadcast or a satellite broadcast, the digital broadcast receiver 100 may be connected to the Internet via an IEEE 1394 or ADSL network.
The virtual machine application program 21 may be comprised of one or more class files. Each of the class files may include a plurality of methods containing execution code, and each of the methods may comprise an execution instruction represented in byte code.
Examples of the virtual machine 23 include the Java virtual machine, Common Language Runtime (CLR), which is a Microsoft virtual machine, and Smalltalk. However, for convenience of explanation, it is assumed that the virtual machine 23 is a Java virtual machine.
The class files constituting the virtual machine application program 23 are transmitted or stored in a specific file format. FIG. 2 is a diagram illustrating a typical format of a Java class file. Referring to FIG. 2, a class file includes various class attributes. The attributes include a class header, a constant pool that manages all of a plurality of constants used in the class, interface information regarding an interface of the class, field information regarding a plurality of fields of the class, and method information regarding a plurality of methods included the class. The method information stores as byte code a plurality of execution instructions respectively corresponding to the methods included in the class.
In the digital broadcast receiver 100, the operation of the DTV middleware program 22 and the operation of the virtual machine 23 are sequentially carried out. However, since, in the digital broadcast receiver 100, a compilation operation is performed during execution of the virtual machine application program 21, the digital broadcast receiver 100 may have the following disadvantages.
First, since a compilation operation is performed during execution of the virtual machine application program 21, the duration of the compilation operation may adversely affect the amount of time taken to execute the virtual machine application program 21. In addition, the compilation operation is carried out with the aid of an interpreter. Thus, the performance of the digital broadcast receiver 100 is poorer than the performance of a digital broadcast receiver that compiles a virtual machine application program into machine code and then executes the compiled virtual machine application program, and it generally takes the digital broadcast receiver 100 a long time to respond to a user.
Second, the digital broadcast receiver 100 performs a compilation operation whenever there is the need to execute a virtual machine application program. Thus, the digital broadcast receiver 100 may compile the same virtual machine application program over and over again instead of re-using the compilation.
Third, in the case of compiling a virtual machine application program stored in a permanent storage device without an automatic start option set therein, the digital broadcast receiver 100 must wait for a user to choose an icon corresponding to the virtual machine application program instead of readily executing the virtual machine application program, thus wasting system resources.
In order to solve the above problems with a conventional virtual machine performing a just-in-time (JIT) compilation operation, various methods have been suggested.
U.S. Pat. No. 6,412,108 discloses a method of optimizing the performance of a Java method in which Java byte code is compiled before Java classes are executed. In this method, a plurality of Java classes compiled into machine code in advance are directly executed without the aid of an interpreter, and thus, it is possible to reduce the amount of time required to execute a virtual machine application program by as much time as it takes an interpreter to interpret the Java classes. In this method, however, there is still a high possibility that a user will be adversely affected by the amount of time taken to perform the compilation operation because the compilation operation is performed after issuing a request for the execution of a class. In addition, in this method, even Java methods that are not often executed are compiled whenever a compilation operation is performed, thus increasing the time it takes a virtual machine to respond to a user.
U.S. Pat. No. 6,110,226 discloses an ahead-of-time (AOT) compilation method in which a plurality of classes are compiled in advance and the compilation results are stored in a storage device. In this AOT compilation method, the classes are compiled before a request for the execution of the classes is issued to a virtual machine. Thus, the compilation operation does not affect the amount of time required by a virtual machine to respond to a user. However, this AOT compilation method requires a device manufacturer to compile the classes in advance and store the results in the device, such as a digital broadcast receiver, when manufacturing the device. Therefore, this AOT compilation method may not be suitable for handling classes that are dynamically downloaded from their sources, such as digital broadcasts.
U.S. Pat. No. 6,295,638 discloses a method of loading native object code into a data processing system in which a virtual machine application program is JIT-compiled and the JIT compilation is stored as a file. This code loading method can solve the problems of conventional JIT compilation method by recycling the compilation. In other words, this code loading method prevents the same virtual machine application program from being compiled more than once, thus reducing the overall compilation time. However, it takes almost as much time to compile a new virtual machine application program in this code loading method as in the JIT compilation method. In addition, like the conventional JIT compilation method, this code loading method does not use system resources efficiently as a virtual machine waits for a user to input information thereto.
U.S. Pat. No. 5,970,249 discloses an optimized method where Java classes are compiled when a Java virtual machine is idle. This optimized method makes it possible to efficiently use system resources by compiling a plurality of methods that have not been compiled in an increasing order of their priority levels during idle time after executing the methods. In this method, a compilation operation is performed during idle time, thereby making it possible to more efficiently use system resources than in the conventional JIT compilation method. In this method, however, a compilation operation is performed after an execution request is issued, and thus, the time it takes a virtual machine to respond to a user increases by as much as the duration of the compilation operation. In addition, in this method, a plurality of methods included in a Java class must be interpreted in order to determine their priority levels, regardless of whether they are frequently executed, and thus, the amount of time required to execute the Java class undesirably increases.